//
//  RecStoryCollectionViewCell.m
//  TravelEveryDay
//
//  Created by dlios on 15-10-15.
//  Copyright (c) 2015年 com.lanou3g. All rights reserved.
//

#import "RecStoryCollectionViewCell.h"

@implementation RecStoryCollectionViewCell
-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 150 * WIDTH, 250 * HEIGHT)];
        _view.layer.cornerRadius = 5;
        _view.layer.masksToBounds = YES;
        _view.backgroundColor = [UIColor whiteColor];
        [self.contentView addSubview:_view];
        
        _image = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 150 * WIDTH, 130 * HEIGHT)];
        _image.backgroundColor = [UIColor redColor];
        [_view addSubview:_image];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10 * WIDTH, 140 * HEIGHT, 130 * WIDTH, 60 * HEIGHT)];
        [_titleLabel setNumberOfLines:2];
        [_view addSubview:_titleLabel];
        
        _iconImage = [[UIImageView alloc] initWithFrame:CGRectMake(10 * WIDTH, 210 * HEIGHT, 30 * WIDTH, 30 * HEIGHT)];
        _iconImage.layer.cornerRadius = 15;
        _iconImage.layer.masksToBounds = YES;
        [_view addSubview:_iconImage];
        
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(50 * WIDTH, 210 * HEIGHT, 100 * WIDTH, 30 * HEIGHT)];
        _nameLabel.alpha = 0.6;
        _nameLabel.font = [UIFont systemFontOfSize:14.];
        [_view addSubview:_nameLabel];
    }
    return self;
}
-(void)getData:(RecStoryModel *)model
{
    [_image sd_setImageWithURL:[NSURL URLWithString:model.index_cover] placeholderImage:PLACEHOLDERIMAGE];
    _titleLabel.text = model.index_title;
}
-(void)getUserData:(RecStoryUserModel *)model
{
    
    [_iconImage sd_setImageWithURL:[NSURL URLWithString:model.avatar_l] placeholderImage:PLACEHOLDERIMAGE];
    _nameLabel.text = model.name;
}
@end
